PATHMac OS 8 and 9 Developer Documentation > Networking and Communications > URL Access Manager >

Transferring Files With the URL Access Manager


URLGetBuffer

Gets the next buffer of data in a download operation.

OSStatus URLGetBuffer (
                     URLReference urlRef,
                     void** buffer,
                     Size *bufferSize);
urlRef
A reference of type URLReference that identifies the URL whose data is being downloaded.
buffer
An untyped pointer to a pointer to a buffer. On return, the buffer contains the downloaded data.
bufferSize
A pointer to a value of type Size . On return, bufferSize contains the number of bytes of data in the buffer. For more information on type Size see Inside Macintosh: Memory .
function result
A result code. For a list of possible result codes, see Result Codes .

DISCUSSION

The URLGetBuffer function obtains the next buffer of data in a download operation. The URLGetBuffer function is used by applications that call URLOpen with a fileSpec parameter that is NULL and that do not need to retain or modify the transferred data.

Each buffer returned by URLGetBuffer is provided by the URL Access Manager, so your application should call URLReleaseBuffer URLReleaseBuffer as soon as possible to prevent the URL Access Manager from running out of buffers.

You should call URLGetBuffer repeatedly until your notification callback routine returns kURLCompletedEvent or kURLAbortInitiatedEvent , or until URLGetStatus returns kURLTransactionComplete or kURLAbortingState . Between calls to URLGetBuffer , you should call URLIdle to allow time for the URL Access Manager to refill its buffers.

WARNING

The data in the buffer returned by URLGetBuffer cannot be modified or retained for a long period of time. You should release the buffer as soon as possible by calling URLReleaseBuffer URLReleaseBuffer .


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)